<template>
	<view class="todo-list">
		<u-cell-group>
				<u-cell-item title="资产名称" :value="cmdbDateil.name" :arrow="false"></u-cell-item>
				<u-cell-item title="资产状态" :value="cmdbDateil.status" :arrow="false"></u-cell-item>
				<u-cell-item title="资产IP" :value="cmdbDateil.ipConfig" :arrow="false"></u-cell-item>
				<u-cell-item title="使用状态" :value="cmdbDateil.useStatus" :arrow="false"></u-cell-item>
				<u-cell-item title="资产类型" :value="cmdbDateil.typeName" :arrow="false"></u-cell-item>
				<u-cell-item title="资产位置" :value="cmdbDateil.siteName" :arrow="false"></u-cell-item>
				<u-cell-item title="资产创建时间" :value="cmdbDateil.createTime" :arrow="false"></u-cell-item>
				<u-cell-item title="资产在线状态" :value="cmdbDateil.online == '-1' ? '不在线': '在线'" :arrow="false"></u-cell-item>
				<u-cell-item title="查看GIS位置" :arrow="true" @click="getGis"></u-cell-item>
			</u-cell-group>
	</view>
</template>

<script>
	export default {
		data () {
			return {
				id: "",
				cmdbDateil: {}
			}
		},
		onLoad(val) {
			this.id = val.id
			this.getCmdbDateil()
		},
		methods: {
			// 获取详情
			getCmdbDateil () {
				this.$request('', '/resourceCenter/cmdb/resource/selectCheckPlanResourceById', 'get', {
					id: this.id
				}, {}, ).then(
					res => {
						const {
							data
						} = res;
						// console.log(rows)
						this.cmdbDateil = data;
					})
			},
			// 跳转gis
			getGis() {
				this.$request('', '/resourceCenter/cmdb/resource/getGisInfo', 'get', {
					id: this.id
				}, {}, ).then(res => {
					uni.navigateTo({
						url: '/pages/gis/index?id=' + res.data.gisSmid + '&gisInfo=' + res.data.gisInfo
					})
				})
			}
		}
	}
</script>

<style>
	.todo-list {
		overflow: scroll;
		background-color: #fff;
		height: 100vh;
		width: 100%;
		display: flex;
		align-items: center;
		flex-direction: column;}
</style>